home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 February: Tool Chest / Dev.CD Feb 95 / Dev.CD Feb 95.toast / New System Software Extensions / ASLM SDK v1.1.2 / ASLM Examples / Example Tools / Sources / TInterruptSchedulerExample.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-21  |  1.6 KB  |  73 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        TInterruptSchedulerExample.h
  3.  
  4.     Contains:    Declaration of the TVBLOperation class which is scheduled by a vbl.
  5.                 All its process method does is bump up a count of the number of times
  6.                 it's been called.
  7.  
  8.     Copyright:    © 1993 by Apple Computer, Inc., all rights reserved.
  9.  
  10. */
  11.  
  12. #ifndef __TINTERRUPTSCHEDULEREXAMPLE1__
  13. #define __TINTERRUPTSCHEDULEREXAMPLE1__
  14.  
  15. #ifndef __MEMORY__
  16. #include <memory.h>
  17. #endif
  18.  
  19. #ifndef __RETRACE__
  20. #include <Retrace.h>
  21. #endif
  22.  
  23. #ifndef __SYSEQU__
  24. #include <SysEqu.h>
  25. #endif
  26.  
  27. #ifndef __TOOLUTILS__
  28. #include <ToolUtils.h>
  29. #endif
  30.  
  31. ///————————————————————————————————————————————————————————————————————————————————————
  32. ///    TVBLOperation
  33. ///————————————————————————————————————————————————————————————————————————————————————
  34.  
  35. class TVBLOperation : public TOperation {
  36.     public:
  37.                         TVBLOperation();    // Constructor
  38.         virtual            ~TVBLOperation();    // Destructor
  39.         virtual void    Process();            // Override
  40.                 int        GetCount();
  41.  
  42.     private:
  43.         int    fCount;                            // number of times called
  44. };
  45.  
  46. ///————————————————————————————————————————————————————————————————————————————————————
  47. ///    TVBLOperation IMPLEMENTATION
  48. ///————————————————————————————————————————————————————————————————————————————————————
  49.  
  50.     TVBLOperation::TVBLOperation()
  51.     {
  52.         fCount = 0;
  53.     }
  54.  
  55.     TVBLOperation::~TVBLOperation()
  56.     {
  57.     }
  58.  
  59.     int TVBLOperation::GetCount()
  60.     {
  61.         return fCount;
  62.     }
  63.  
  64.     // Ok, so this isn't exactly what you expected for a heavy duty process method.
  65.     // Normally if you were doing something so simple you wouldn't schedule an
  66.     // operation for it. Just make beleave fCount++ takes a long time
  67.     void TVBLOperation::Process()
  68.     {
  69.         fCount++;
  70.     }
  71.  
  72.  
  73. #endif